package com.ruoyi.config.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; //添加
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SnowflakeIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.config.mapper.DatarulesconfigMapper;
import com.ruoyi.config.domain.Datarulesconfig;
import com.ruoyi.config.service.IDatarulesconfigService;

/**
 * 规则配置Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-14
 */
@Service
public class DatarulesconfigServiceImpl extends ServiceImpl<DatarulesconfigMapper, Datarulesconfig> implements IDatarulesconfigService //修改
{
    @Autowired
    private DatarulesconfigMapper datarulesconfigMapper;

    /**
     * 查询规则配置
     * 
     * @param ruleId 规则配置主键
     * @return 规则配置
     */
    @Override
    public Datarulesconfig selectDatarulesconfigByRuleId(String ruleId)
    {
        return datarulesconfigMapper.selectDatarulesconfigByRuleId(ruleId);
    }

    /**
     * 查询规则配置列表
     * 
     * @param datarulesconfig 规则配置
     * @return 规则配置
     */
    @Override
    public List<Datarulesconfig> selectDatarulesconfigList(Datarulesconfig datarulesconfig)
    {
        return datarulesconfigMapper.selectDatarulesconfigList(datarulesconfig);
    }

    /**
     * 新增规则配置
     * 
     * @param datarulesconfig 规则配置
     * @return 结果
     */
    @Override
    public int insertDatarulesconfig(Datarulesconfig datarulesconfig)
    {
        datarulesconfig.setRuleId(String.valueOf(new SnowflakeIdUtils(5,8).nextId()));
        datarulesconfig.setCreateTime(DateUtils.getNowDate());
        return datarulesconfigMapper.insertDatarulesconfig(datarulesconfig);
    }

    /**
     * 修改规则配置
     * 
     * @param datarulesconfig 规则配置
     * @return 结果
     */
    @Override
    public int updateDatarulesconfig(Datarulesconfig datarulesconfig)
    {
        datarulesconfig.setUpdateTime(DateUtils.getNowDate());
        return datarulesconfigMapper.updateDatarulesconfig(datarulesconfig);
    }

    /**
     * 批量删除规则配置
     * 
     * @param ruleIds 需要删除的规则配置主键
     * @return 结果
     */
    @Override
    public int deleteDatarulesconfigByRuleIds(String[] ruleIds)
    {
        return datarulesconfigMapper.deleteDatarulesconfigByRuleIds(ruleIds);
    }

    /**
     * 删除规则配置信息
     * 
     * @param ruleId 规则配置主键
     * @return 结果
     */
    @Override
    public int deleteDatarulesconfigByRuleId(String ruleId)
    {
        return datarulesconfigMapper.deleteDatarulesconfigByRuleId(ruleId);
    }
}
